package com.wd.tw.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.wd.tw.domain.entity.ElevatorPersonNum;
import com.wd.tw.service.ElevatorPersonNumService;
import org.springframework.security.access.prepost.PreAuthorize;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wd.common.core.controller.BaseController;
import com.wd.common.core.domain.HttpResponse;
import com.wd.common.annotation.Log;
import com.wd.common.enums.BusinessType;

import com.wd.common.utils.poi.ExcelUtil;


/**
 * 电梯人数信息Controller
 * 
 * @author liumingkun
 * @date 2024-12-19
 */
@RestController
@RequestMapping("/business/num")
public class ElevatorPersonNumController extends BaseController
{
    @Resource
    private ElevatorPersonNumService elevatorPersonNumService;

    /**
     * 查询电梯人数信息列表
     */
    @PreAuthorize("@ss.hasPermi('business:num:list')")
    @GetMapping("/list")
    public HttpResponse list(ElevatorPersonNum elevatorPersonNum)
    {
        startPage();
        List<ElevatorPersonNum> list = elevatorPersonNumService.selectElevatorPersonNumList(elevatorPersonNum);
        return HttpResponse.successData(getDataTable(list));
    }

    /**
     * 导出电梯人数信息列表
     */
    @PreAuthorize("@ss.hasPermi('business:num:export')")
    @Log(title = "电梯人数信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ElevatorPersonNum elevatorPersonNum)
    {
        List<ElevatorPersonNum> list = elevatorPersonNumService.selectElevatorPersonNumList(elevatorPersonNum);
        ExcelUtil<ElevatorPersonNum> util = new ExcelUtil<ElevatorPersonNum>(ElevatorPersonNum.class);
        util.exportExcel(response, list, "电梯人数信息数据");
    }

    /**
     * 获取电梯人数信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:num:query')")
    @GetMapping(value = "/{recordId}")
    public HttpResponse getInfo(@PathVariable("recordId") Long recordId)
    {
        return successData(elevatorPersonNumService.selectElevatorPersonNumByRecordId(recordId));
    }

    /**
     * 新增电梯人数信息
     */
    @PreAuthorize("@ss.hasPermi('business:num:add')")
    @Log(title = "电梯人数信息", businessType = BusinessType.INSERT)
    @PostMapping
    public HttpResponse add(@RequestBody ElevatorPersonNum elevatorPersonNum)
    {
        return getResult(elevatorPersonNumService.insertElevatorPersonNum(elevatorPersonNum));
    }

    /**
     * 修改电梯人数信息
     */
    @PreAuthorize("@ss.hasPermi('business:num:edit')")
    @Log(title = "电梯人数信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public HttpResponse edit(@RequestBody ElevatorPersonNum elevatorPersonNum)
    {
        return getResult(elevatorPersonNumService.updateElevatorPersonNum(elevatorPersonNum));
    }

    /**
     * 删除电梯人数信息
     */
    @PreAuthorize("@ss.hasPermi('business:num:remove')")
    @Log(title = "电梯人数信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{recordIds}")
    public HttpResponse remove(@PathVariable Long[] recordIds)
    {
        return getResult(elevatorPersonNumService.deleteElevatorPersonNumByRecordIds(recordIds));
    }
}
